﻿@using si.caha.Repository;

@{
    Layout = "/tpl/_layout.cshtml";
    PageData["PageTitle"] = "Delete item?";

    if (IsPost)
    {
        var id = UrlData[0].IsInt() ? UrlData[0].AsInt() : 0;
        
        var dataContext = new DataContext();
        var itemRepository = new ItemRepository(dataContext);
        itemRepository.Delete(id);
        Response.Redirect("~/Admin/Items");
    }
}
<form method="post" action="">
    <input type="submit" value="Confirm" />
</form>
<a href="@Href("~/Admin/Items")">Go back</a>